<template>
  <view class="body">
    <uni-popup ref="popupDialog" type="dialog">
      <uni-popup-dialog
        :type="msgType"
        title="温馨提示"
        content="如果点击同意则代表您同意了"
        :before-close="true"
        @confirm="dialogConfirm"
        @close="dialogClose"
      ></uni-popup-dialog>
    </uni-popup>
    <view class="container">
      <image src="/static/first.png" />
    </view>
  </view>
</template>
<script>
import uniPopup from "@/components/uni-popup/uni-popup.vue";
import uniPopupMessage from "@/components/uni-popup/uni-popup-message.vue";
import uniPopupDialog from "@/components/uni-popup/uni-popup-dialog.vue";
export default {
  onReady() {
    // 页面打开自动打开对话框
    const first = uni.getStorageSync("first");
    if (first.length <= 0) {
      setTimeout(() => {
        this.msgType = "success";
        this.$refs.popupDialog.open();
      }, 500);
    }
  },
  components: {
    uniPopup,
    uniPopupMessage,
    uniPopupDialog,
  },
  methods: {
    dialogConfirm() {
      uni.setStorageSync("first", "ok");
      this.$refs.popupDialog.close()
      uni.switchTab({
        url:"../index/index"
      })
    },
    dialogClose() {
      this.$refs.popupDialog.close()
    },
  },
  data(){
	return{
		  msgType:''
	}
  }
};
</script>
<style scoped lang="scss">
.body {
  width: 100%;
  height: 100%;
  .container {
    width: 100%;
    height: 100%;
    image {
      width: 100%;
      height: 100%;
    }
  }
}
</style>